package Randomizer

import "math/rand"

func NextInt(max int32) int32 {
	return rand.Int31n(max)
}

func NextInt_() int32 {
	return rand.Int31()
}

func NextBytes(b []byte) []byte {
	for i, length := 0, len(b); i < length; i++ {
		b[i] = byte(NextInt_())
	}
	return b
}

func NextBoolean() bool {
	return NextInt(1) == 0
}

func Rand(l int32, h int32) int32 {
	return NextInt(h-l+1) + l
}

func IsSuccess(rate int32) bool {
	return rate > NextInt(100)
}
